﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Blitzkopf
{
    class Cell : DependencyObject
    {
        private static Random rand = new Random();

        private static DependencyProperty selectedProperty = 
            DependencyProperty.Register("Selected", typeof(bool), typeof(Cell), 
            new PropertyMetadata(false, new PropertyChangedCallback(selectedPropertyChanged)));

        private static DependencyProperty numberProperty = 
            DependencyProperty.Register("Number", typeof(int), typeof(Cell));

        public bool Selected
        {
            get { return (bool)GetValue(selectedProperty); }
            set { SetValue(selectedProperty, value); }
        }

        public int Number
        {
            get { return (int)GetValue(numberProperty); }
            set { SetValue(numberProperty, value); }
        }

        public Cell()
        {
            Number = rand.Next(1, 9);
        }

        public void NewNumber()
        {
            Number = rand.Next(1, 9);
        }

        private static void selectedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {

        }

        public override string ToString()
        {
            return Number.ToString();
        }
    }
}
